package editor3d;
import java_cup.runtime.Symbol;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.util.*;

%%

%{
	public static int linea = 0;
	public void ErrorLex(String str){
		System.out.println("Error Lexico: "+str+" Linea: "+linea);
	}
%}

%cup
%public
%full
%line
%char
%class lexopt
%ignorecase
%eofval{
	return new Symbol(symopt.EOF,new String("Fin de Archivo"));
%eofval}
D = [0-9]
L = [a-zA-Z]
eps=([ \t\r\f])+
inclu = "#include "
%%

({inclu})"<stdio.h>"
			{linea=yyline;
			 return new Symbol(symopt.include1,	new String(yytext()));
			}

({inclu})"<conio.h>"
			{linea=yyline;
			 return new Symbol(symopt.include2,	new String(yytext()));
			}

({inclu})"<iostream.h>"
			{linea=yyline;
			 return new Symbol(symopt.include3,	new String(yytext()));
			}

({inclu})"<stdlib.h>"
			{linea=yyline;
			 return new Symbol(symopt.include4,	new String(yytext()));
			}

({inclu})"<math.h>"
			{linea=yyline;
			 return new Symbol(symopt.include5,	new String(yytext()));
			}

";"
			{linea=yyline;
			 return new Symbol(symopt.pcoma,	new String(yytext()));
			}

"{"
			{linea=yyline;
			 return new Symbol(symopt.llavea,	new String(yytext()));
			}

"}"
			{linea=yyline;
			 return new Symbol(symopt.llavec,	new String(yytext()));
			}

"="
			{linea=yyline;
			 return new Symbol(symopt.igual,	new String(yytext()));
			}

":"
			{linea=yyline;
			 return new Symbol(symopt.dosp,		new String(yytext()));
			}

","
			{linea=yyline;
			 return new Symbol(symopt.coma,		new String(yytext()));
			}

"("
			{linea=yyline;
			 return new Symbol(symopt.par,		new String(yytext()));
			}

")"
			{linea=yyline;
			 return new Symbol(symopt.parc,		new String(yytext()));
			}

"["
			{linea=yyline;
			 return new Symbol(symopt.cora,		new String(yytext()));
			}

"]"
			{linea=yyline;
			 return new Symbol(symopt.corc,		new String(yytext()));
			}
"+"
			{linea=yyline;
			 return new Symbol(symopt.mas,		new String(yytext()));
			}

"-"
			{linea=yyline;
			 return new Symbol(symopt.menos,	new String(yytext()));
			}

"*"
			{linea=yyline;
			 return new Symbol(symopt.por,		new String(yytext()));
			}

"/"
			{linea=yyline;
			 return new Symbol(symopt.div,		new String(yytext()));
			}

"%"
			{linea=yyline;
			 return new Symbol(symopt.porc,		new String(yytext()));
			}

"."
			{linea=yyline;
			 return new Symbol(symopt.punto,	new String(yytext()));
			}

"=="
			{linea=yyline;
			 return new Symbol(symopt.iigual,	new String(yytext()));
			}

"!="
			{linea=yyline;
			 return new Symbol(symopt.noigual,	new String(yytext()));
			}

">"
			{linea=yyline;
			 return new Symbol(symopt.mayor,	new String(yytext()));
			}

"<"
			{linea=yyline;
			 return new Symbol(symopt.menor,	new String(yytext()));
			}

">="
			{linea=yyline;
			 return new Symbol(symopt.maigual,	new String(yytext()));
			}

"<="
			{linea=yyline;
			 return new Symbol(symopt.meigual,	new String(yytext()));
			}

"&"
			{linea=yyline;
			 return new Symbol(symopt.amb,		new String(yytext()));
			}

"pila"
			{linea=yyline;
			 return new Symbol(symopt.pila,		new String(yytext()));
			}
			
"heap"
			{linea=yyline;
			 return new Symbol(symopt.heap,		new String(yytext()));
			}

"ptr"
			{linea=yyline;
			 return new Symbol(symopt.ptr,		new String(yytext()));
			}

"ptrmemo"
			{linea=yyline;
			 return new Symbol(symopt.ptrmemo,		new String(yytext()));
			}
			
"tmpc"
			{linea=yyline;
			 return new Symbol(symopt.tmpc,		new String(yytext()));
			}

"if"
			{linea=yyline;
			 return new Symbol(symopt.si,		new String(yytext()));
			}

"int"
			{linea=yyline;
			 return new Symbol(symopt.ent,		new String(yytext()));
			}
"float"
			{linea=yyline;
			 return new Symbol(symopt.flot,		new String(yytext()));
			}

"char"
			{linea=yyline;
			 return new Symbol(symopt.car,		new String(yytext()));
			}

"void"
			{linea=yyline;
			 return new Symbol(symopt.boid,		new String(yytext()));
			}

"goto"
			{linea=yyline;
			 return new Symbol(symopt.go,		new String(yytext()));
			}

"printf"
			{linea=yyline;
			 return new Symbol(symopt.print,	new String(yytext()));
			}

"scanf"
			{linea=yyline;
			 return new Symbol(symopt.scanf,	new String(yytext()));
			}

"main(char * c)" 
			{linea=yyline;
			 return new Symbol(symopt.main,	new String(yytext()));
			}
"t"({D})+
			{linea=yyline;
			 return new Symbol(symopt.tempo,	new String(yytext()));
			}

"L"({D})+
			{linea=yyline;
			 return new Symbol(symopt.etq,		new String(yytext()));
			}

({L})({L}|{D}|"_"|)*
			{linea=yyline;
			 return new Symbol(symopt.id,		new String(yytext()));
			}

({D})+|(({D})+"."({D})+)
			{linea=yyline;
			 return new Symbol(symopt.num,		new String(yytext()));
			}

"'"[^"'"]?("'")
			{linea=yyline;
			 return new Symbol(symopt.carac,	new String(yytext()));
			}

"\""[^"\""]*("\"")
			{linea=yyline;
			 return new Symbol(symopt.cadena,		new String(yytext()));
			}
[\n] 
		{linea=yyline;
			}

"//"[^"\n"]*
			{}

"/*"[^"*/"]*("*/")
			{}

{eps}	{}

.			{if(yytext()!=" "){ErrorLex(yytext());}}